import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description: 第七题
 * User: 姚东名
 * Date: 2024-11-16
 * Time: 10:37
 */
public class Test {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int count = 0;

        while (n != 0) {
            String numStr = Integer.toString(n);
            StringBuilder newNumStr = new StringBuilder();

            for (int i = 0; i < numStr.length(); i++) {
                int digit = numStr.charAt(i) - '0';
                if (digit > 0) {
                    newNumStr.append(digit - 1);
                } else {
                    newNumStr.append(digit);
                }
            }

            n = Integer.parseInt(newNumStr.toString());
            count++;
        }

        System.out.println(count);
    }
}
